package com.shop.admin.dao.admin;

import com.shop.domain.admin.Admin;
import com.shop.jpa.BaseDao;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;


public interface AdminDao extends BaseDao<Admin, Long> {

    @Query("from Admin where mobile = ?1 or name = ?1")
    Admin findAdminByMobileOrName(String mobile);

    @Modifying(clearAutomatically = true)
    @Query("update Admin set idNumber = ?2 , realityName = ?3 where id = ?1")
    int updateIdCardAndRealName(Long adminId, String idCard, String name);

    @Modifying(clearAutomatically = true)
    @Query("update Admin set pwd = ?2 where id = ?1")
    int modifyPwd(Long adminId, String pwd);

    @Modifying(clearAutomatically = true)
    @Query("update Admin set lockType = ?2 where id = ?1")
    int lock(Long adminId, int lockType);

}
